package com.hd.crdao.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hd.crdao.R;
import com.hd.crdao.base.MyBaseAdapter;
import com.hd.crdao.bean.MessageBean;
import com.hd.crdao.utils.UIUtils;

import java.util.List;

/**
 *
 *@author Programming
 *@date 2017/6/5 0005
 */
public class MessageAdapter extends MyBaseAdapter<MessageBean.RowsBean> {
    public MessageAdapter(List<MessageBean.RowsBean> dataSets) {
        super(dataSets);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = View.inflate(UIUtils.getContext(), R.layout.item_messagecenter, null);
            holder = new ViewHolder();
            holder.mTtitleMessgae = (TextView) convertView.findViewById(R.id.ttitle_messgae);
            holder.mTimeMessage = (TextView) convertView.findViewById(R.id.time_message);
            holder.mMessageContent = (TextView) convertView.findViewById(R.id.messageContent);

            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        MessageBean.RowsBean rowsBean = mDataSets.get(position);
        holder.mTimeMessage.setText(rowsBean.getCreateDate());
        holder.mTtitleMessgae.setText(rowsBean.getSmTitle());
        holder.mMessageContent.setText(rowsBean.getSmContent());

        return convertView;
    }

    class ViewHolder {
        TextView mTtitleMessgae;
        TextView mTimeMessage;
        TextView mMessageContent;


    }
}
